package com.ruoyi.web.controller.api;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.system.mpparam.ReqPoint;
import com.ruoyi.system.mpparam.ResPoint;
import com.ruoyi.system.service.IApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 小程序请求处理
 *
 * @author ruoyi
 */
@Controller
@RequestMapping("/api")
public class ApiController extends BaseController {

    private static final Logger log = LoggerFactory.getLogger(ApiController.class);

    @Autowired
    private IApiService apiService;

    @PostMapping("/loadMapPoints")
    @ResponseBody
    public List<ResPoint> loadMapPoints(@RequestBody ReqPoint reqPoint) throws BusinessException {
        List<ResPoint> pointList = apiService.loadMapPoints(reqPoint);
        return pointList;
    }

    @PostMapping("/loadPointList")
    @ResponseBody
    public List<ResPoint> loadPointList(@RequestBody ReqPoint reqPoint) throws BusinessException {
        List<ResPoint> pointList = apiService.loadPointList(reqPoint);
        return pointList;
    }
}
